import "../styles/appleItem.less"
import appleImg from '../images/apple.png'
import { useStore } from '../store'
const AppleItem = ({apple: { weight, id }})=>{
  const {eat} = useStore()
  return (
    <div className="appleItem">
      <div className="apple">
        <img src={appleImg} alt="" />
      </div>
      <div className="info">
        <div className="name">红苹果 - {id}号</div>
        <div className="weight">{weight}克</div>
      </div>
      <div className="btn-div">
        <button onClick={() => eat(id)}> 吃掉 </button>
      </div>
    </div>
  );
}
export default AppleItem
